package org.wu.framework.authorization.platform.application.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.wu.framework.authorization.platform.application.SysInterfaceApplication;
import org.wu.framework.authorization.platform.application.assembler.SysInterfaceDTOAssembler;
import org.wu.framework.authorization.platform.application.command.SysInterfaceCommand;
import org.wu.framework.authorization.platform.domain.model.sys.interface_.SysInterface;
import org.wu.framework.authorization.platform.domain.model.sys.interface_.SysInterfaceRepository;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplicationImpl;
import org.wu.framework.lazy.orm.web.plus.stereotype.LazyApplication;
import org.wu.framework.web.response.Result;

import java.util.List;

/**
 * describe 接口
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyApplicationImpl
 **/
@LazyApplication
public class SysInterfaceApplicationImpl implements SysInterfaceApplication {

    @Autowired
    SysInterfaceRepository interface_Repository;

    /**
     * describe 新增接口
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @Override
    public Result<SysInterface> save(SysInterfaceCommand interface_Command) {
        SysInterface sysInterface_ = SysInterfaceDTOAssembler.toInterface(interface_Command);
        return interface_Repository.story(sysInterface_);
    }

    /**
     * describe 更新接口
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @Override
    public Result<SysInterface> update(SysInterfaceCommand interface_Command) {
        SysInterface sysInterface_ = SysInterfaceDTOAssembler.toInterface(interface_Command);
        return interface_Repository.story(sysInterface_);
    }

    /**
     * describe 查询单个接口
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @Override
    public Result<SysInterface> findOne(SysInterfaceCommand interface_Command) {
        SysInterface sysInterface_ = SysInterfaceDTOAssembler.toInterface(interface_Command);
        return interface_Repository.findOne(sysInterface_);
    }

    /**
     * describe 查询多个接口
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @Override
    public Result<List<SysInterface>> findList(SysInterfaceCommand interface_Command) {
        SysInterface sysInterface_ = SysInterfaceDTOAssembler.toInterface(interface_Command);
        return interface_Repository.findList(sysInterface_);
    }

    /**
     * describe 删除接口
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @Override
    public Result<SysInterface> delete(SysInterfaceCommand interface_Command) {
        SysInterface sysInterface_ = SysInterfaceDTOAssembler.toInterface(interface_Command);
        return interface_Repository.delete(sysInterface_);
    }

}